package com.project.controller;

import com.project.bean.ReplyBean;
import com.project.bean.StickBean;
import com.project.bean.UserBean;
import com.project.service.IReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("reply")
public class ReplyController {
    @Autowired
    private IReplyService service;
    @RequestMapping("add")
    public String add(ReplyBean reply, HttpServletRequest request){
        UserBean user = (UserBean) request.getSession().getAttribute("loginUser");
        reply.setUserId(user.getUserId());
        service.add(reply);
        return "ok";
    }
}
